package modeller.databasedesignmodel.servicedemand.transaction.sqlquery.calculatorfetcher;

import modeller.databasedesignmodel.DatabaseDesign;
import modeller.databasedesignmodel.relation.index.*;
import modeller.databasedesignmodel.servicedemand.transaction.sqlquery.demandFetcher.*;

/**
 * Created by:  Jason Ye
 * Date:        26/03/2012
 * Time:        23:57
 */
public class SQLQueryServiceDemandCalculatorFetcher implements ISQLQueryServiceDemandCalculatorFetcher {

    private DatabaseDesign design;

    public SQLQueryServiceDemandCalculatorFetcher(DatabaseDesign design) {
        this.design = design;
    }

    @Override
    public ISQLQueryServiceDemandCalculator fetch(HeapIndex index) {
        return new HeapCalculatorVisitor(design);
    }

    @Override
    public ISQLQueryServiceDemandCalculator fetch(SortedIndex index) {
        return new SortedCalculatorVisitor(design);
    }

    @Override
    public ISQLQueryServiceDemandCalculator fetch(UniqueClusteredTreeIndex index) {
        return new UniqueClusteredTreeIndexCalculatorVisitor(design);
    }

    @Override
    public ISQLQueryServiceDemandCalculator fetch(UniqueUnclusteredTreeIndex index) {
        return new UniqueUnclusteredTreeIndexCalculatorVisitor(design);
    }

    @Override
    public ISQLQueryServiceDemandCalculator fetch(NonUniqueClusteredTreeIndex nonUniqueClusteredTreeIndex) {
        return new NonUniqueClusteredTreeIndexCalculatorVisitor(design);
    }

    @Override
    public ISQLQueryServiceDemandCalculator fetch(NonUniqueUnclusteredTreeIndex nonUniqueUnclusteredTreeIndex) {
        return new NonUniqueUnclusteredTreeIndexCalculatorVisitor(design);
    }
}
